const express = require("express");
const route = express.Router();
//引入权限校验中间件
const isLoginMiddle = require("../middleware/isLoginMiddle")
const advModel = require('../db/model/advMode')
route.get('/getUpdateData', isLoginMiddle, async (req, res) => {
  const { _id } = req.query
  // 去数据库查询当前id对应的数据
  try {
    const findResult = await advModel.findOne({
      _id
    })
    // 把响应到的值响应给前端
    res.send({
      code: 10000,
      msg: '更新数据成功',
      data: findResult
    })
  } catch (e) {
    console.log('更新数据查询失败' + e.message);
    res.send({
      code: 10001,
      msg: '更新数据失败' + e.message,
      data: null
    })
  }
})
module.exports = route